<template>
  <el-container>
    <el-row class="wrap" v-loading="loading" element-loading-text="拼命加载中">
      <el-col :span="24" class="warp-breadcrum">
        <el-breadcrumb separator="/">
          <el-breadcrumb-item :to="{ path: '/dashboard' }"><span style="color: #837e7c;font-weight: normal;">首页</span></el-breadcrumb-item>
          <el-breadcrumb-item><span style="color: #837e7c;font-weight: normal;">AI外呼流程</span></el-breadcrumb-item>
          <el-breadcrumb-item><span style="color: #5d9cec;font-weight: normal;">AI外呼任务流程</span></el-breadcrumb-item>
        </el-breadcrumb>
      </el-col>

      <el-col :span="24" class="wrap-main">
        <!--工具栏-->
        <el-col :span="24" class="gg-toolBar-wrap">
          <el-col :span="24" class="toolbar gg-toolBar">
            <el-form :inline="true" :model="formInline">
              <el-form-item prop="taskStartDate">
                <el-date-picker size="small" type="date" placeholder="请选择开始时间" v-model="formInline.taskStartDate" style="width:152px;"
                                @keyup.enter.native="handleSearch"></el-date-picker>
              </el-form-item>
              <el-form-item prop="taskEndDate">
                <el-date-picker size="small" type="date" placeholder="请选择结束时间" v-model="formInline.taskEndDate" style="width:152px;"
                                @keyup.enter.native="handleSearch"></el-date-picker>
              </el-form-item>
              <el-form-item>
                <el-input size="small" v-model="formInline.processName" placeholder="输入流程名称" style="min-width: 240px;"
                          @keyup.enter.native="handleSearch"></el-input>
              </el-form-item>
              <el-form-item>
                <el-button type="primary" size="small" icon="el-icon-search" @click="handleSearch">搜索</el-button>
              </el-form-item>
            </el-form>
          </el-col>
        </el-col>
        <!--表格区域-->
        <el-col :span="24" class="gg-tableMainWrap">
          <!--新建按钮-->
          <el-row class="gg-tableBtnWrap">
            <el-button type="primary" size="small" icon="el-icon-plus">新建流程</el-button>
          </el-row>
          <!--表格-->
          <el-row class="gg-tableWrap">
            <el-table :data="tableData" border highlight-current-row style="width: 100%;">
              <el-table-column prop="processNum" label="流程编号">
              </el-table-column>
              <el-table-column prop="processName" label="流程名称">
              </el-table-column>
              <el-table-column prop="processType" label="所属行业" width="150">
              </el-table-column>
              <el-table-column prop="processUpdateTime" label="更新时间" width="160" sortable>
              </el-table-column>
              <el-table-column label="操作">
                <template slot-scope="scope">
                  <el-button size="mini" type="success" @click="openDetail(isDetail)">详情</el-button>
                  <el-button size="mini" type="danger" @click="remove(scope.$index,scope.row)">删除</el-button>
                </template>
              </el-table-column>
            </el-table>
          </el-row>

          <!--分页插件-->
          <el-col :span="24" class="toolbar">
            <el-pagination
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[10, 20, 30, 50,100]"
              :page-size="10"
              layout="total, sizes, prev, pager, next, jumper"
              style="float:right;">
            </el-pagination>
          </el-col>
        </el-col>
      </el-col>
    </el-row>
  </el-container>
</template>

<script>
  export default {
    name: "CallProcessList",
    data() {
      return {
        total: 0,
        page: 1,
        limit: 10,
        loading: false,
        isDetail:true,
        currentPage: 1,
        formInline: {
          processName: '',
          taskStartDate: '',
          taskEndDate: ''
        },
        tableData: [{
          processNum: '2574',
          processName: '【内置】催收demo',
          processType: '金融行业/金融催缴',
          processUpdateTime:'2018-09-01 17:25:07'
        },{
          processNum: '2577',
          processName: '悟空理财复投',
          processType: '金融行业/理财',
          processUpdateTime:'2018-09-11 17:25:07'
        }]
      }
    },
    methods: {
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        console.log(`当前页: ${val}`);
      },
      handleSearch() {
        console.log('submit!');
      },
      openDetail:function(){
       // this.$router.push({name:'addTask',params:{isDetail:true}})
        console.log('打开流程详情')
      },
      remove:function(index,row){
        let that = this;
        this.$confirm('确定要删除该条记录吗?','操作提示',{
          confirmButtonText:'确定',
          cancelButtonText:'取消',
          type:"warning"
        }).then(()=>{
          this.$message({
            type:'success',
            message:'删除成功!',
          })
        }).catch(()=>{
          this.$message({
            type:'info',
            message:'已取消删除'
          })
        })
      },
    }
  }
</script>

<style scoped>
  .el-tag {
    padding: 0px 8px;
    height: 25px;
    line-height: 25px;
    font-size: 11px;
    color: #fff;
    border-radius: 12px;
    box-sizing: border-box;
    border:none;
  }
</style>
